
layui.use(['upload', 'form', 'laydate'], function () { //此段代码必不可少
    var form = layui.form;
    var upload = layui.upload;
    var laydate = layui.laydate;
    //执行实例

    $(function () {
        getPermission();
        form.render();
    })
    form.render();
    //获取码表数据

    function getPermission() {
        let data = null;
        if (sessionStorage.getItem("permission")!=null) {
            data = JSON.parse(sessionStorage.getItem("permission"));
        }else {
            let result = ajaxModel("/permission/getPermissions", "get");
            data = result.data;
            sessionStorage.setItem("permission", JSON.stringify(data));
        }
        console.log(data);
        $("#parent_permission").html("<option value=0>暂不选择</option>");
        $.each(data,function (i,permission) {
            $("#parent_permission").append("<option value='"+ permission.id +"'>"+ permission.name +"</option>");
        });
    }
});
